package cn.darksoul3.spark.streaming

import com.alibaba.druid.pool.DruidDataSourceFactory

import java.sql.Connection
import java.util.Properties
import javax.sql.DataSource

object DruidPool {

  private val props = new Properties()

  props.put("driverClassName","com.mysql.jdbc.Driver")
  props.put("url","jdbc:mysql://192.168.1.51:3306/imdb?characterEncoding=utf8&useUnicode=true&rewriteBatchedStatements=true")
  props.put("username","root")
  props.put("password","root")

  private val dataSource: DataSource = DruidDataSourceFactory.createDataSource(props)

  def getConnection: Connection = {dataSource.getConnection}

}
